home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / ListBinder.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  3.1 KB  |  62 lines

  1. package symantec.itools.db.pro;
  2.  
  3. import java.util.Vector;
  4. import symantec.itools.db.net.RemoteObject;
  5. import symantec.itools.db.net.TextParam;
  6. import symjava.sql.SQLException;
  7.  
  8. public class ListBinder {
  9.    private Vector _columns;
  10.    private Vector _listProjections;
  11.    private RelationView _listRV;
  12.    private RelationView _parentRV;
  13.    private ListLink _listObject;
  14.    private RemoteObject _messgr;
  15.    private Session _session;
  16.    private ConnectionInfo _conn;
  17.    private final int METHOD_getListRelView;
  18.  
  19.    ListBinder(RelationView parRV, int id, Vector colIds, ListLink listObject, Session session, ConnectionInfo conn) throws SQLException {
  20.       this._parentRV = parRV;
  21.       this._columns = colIds;
  22.       this._listObject = listObject;
  23.       this._listRV = null;
  24.       this._session = session;
  25.       this._conn = conn;
  26.       this._messgr = new RemoteObject("ProxyListView", id, this._session.getClientSession());
  27.       this._listProjections = new Vector();
  28.  
  29.       for(int index = 0; index < this._columns.size(); ++index) {
  30.          ListProjection lp = new ListProjection(this);
  31.          Integer temp = (Integer)this._columns.elementAt(index);
  32.          this._listProjections.addElement(lp);
  33.          this._parentRV.bindProj(temp, lp);
  34.       }
  35.  
  36.       this.dataChanged();
  37.       this._listObject.init(this);
  38.    }
  39.  
  40.    public RelationView getRelationView() {
  41.       return this._listRV;
  42.    }
  43.  
  44.    void dataChanged() throws SQLException {
  45.       Vector params = new Vector();
  46.  
  47.       for(int index = 1; index <= this._columns.size(); ++index) {
  48.          params.addElement(new TextParam(1, ((ListProjection)this._listProjections.elementAt(index - 1)).getString()));
  49.       }
  50.  
  51.       Vector results = this._messgr.invokeMethod(0, params);
  52.       MultiView mv = new MultiView(this._session, results, this._conn);
  53.       this._session.addMultiView(mv);
  54.       if (this._listRV != null) {
  55.          this._listRV.closeMultiView();
  56.       }
  57.  
  58.       this._listRV = mv.getRootRelView();
  59.       this._listObject.notifyListChange(this);
  60.    }
  61. }
  62.